@echo off
netstat -an | find /C "TCP" > d:\tcpcount.txt
for /f %%i in (d:\tcpcount.txt) do (
set tcpc=%%i
)


if %tcpc% GTR 5000 ( 
echo  criting: tcp connection count %tcpc%
exit /B 2
)
 
if not %tcpc% GTR 5000 if  %tcpc% GTR 3000 (
echo  wroning: tcp connection count %tcpc%
exit /B 1
)  

if not %tcpc% GTR 3000 ( 
echo  ok: tcp connection count %tcpc%
exit /B 0
)
 